<?php

namespace App\Repositories\SeminarTemplates;

use Prettus\Repository\Eloquent\BaseRepository;
use Prettus\Repository\Criteria\RequestCriteria;
use App\Repositories\SeminarTemplates\SeminarTemplateRepository;
use App\Models\SeminarTemplates\SeminarTemplate;
use App\Validators\SeminarTemplates\SeminarTemplateValidator;

/**
 * Class SeminarTemplateRepositoryEloquent.
 *
 * @package namespace App\Repositories\SeminarTemplates;
 */
class SeminarTemplateRepositoryEloquent extends BaseRepository implements SeminarTemplateRepository
{
    /**
     * Specify Model class name
     *
     * @return string
     */
    public function model()
    {
        return SeminarTemplate::class;
    }

    

    /**
     * Boot up the repository, pushing criteria
     */
    public function boot()
    {
        $this->pushCriteria(app(RequestCriteria::class));
    }

    /**
     * 获取指定专题id的模版
     * @author Jerry
     * @param int $seminarId
     * @return mixed
     */
    public function findSeminarTemplateBySeminarId(int $seminarId)
    {
        $where = [
            'template_id'   =>  $seminarId,
        ];

        return $this->findWhere($where)->toArray();
    }
    
}
